package com.lzs.bootsafety.business.sys.mapper;

import com.github.pagehelper.Page;
import com.lzs.bootsafety.business.sys.entity.SysUser;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author  zhanshi Liu
 * @date    2020/03/23
 * @website www.jhmsona.cn
 */
@Repository
public interface SysUserMapper{
    /**
     * 用户登录
     * @param username
     * @return
     */
    SysUser selectUserByName(@Param("username") String username);

    int deleteByPrimaryKey(Long userId);

    /**
     * 验证邮箱唯一性
     * @param email
     * @return
     */
    SysUser verifyUserByEmail(@Param("email")String email);

    /**
     * 验证手机号唯一性
     * @param mobile
     * @return
     */
    SysUser verifyUserByMobile(@Param("mobile")String mobile);

    /**
     * 多条件查询用户
     * @param sysUser
     * @return
     */
    Page<SysUser> selectUserByWhere(SysUser sysUser);

    /**
     * 查询所有用户
     * @return
     */
    List<SysUser> selectAllUser();

    /**
     * 批量删除
     * @param ids
     * @return
     */
    int remove(Long[] ids);

    int insert(SysUser record);

    /**
     * 添加记录
     * @param record
     * @return
     */
    int insertSelective(SysUser record);

    /**
     * 根据主键查询信息
     * @param userId
     * @return
     */
    SysUser selectByPrimaryKey(Long userId);

    /**
     * 更新单条记录
     * @param record
     * @return
     */
    int updateByPrimaryKeySelective(SysUser record);

    /**
     * 根据userId查询用户
     * @param userIds
     * @return
     */
    List<SysUser> selectUserByUserId(Long[] userIds);

    int updateByPrimaryKey(SysUser record);
}